import axios from 'axios';
import {Indicator} from 'mint-ui'
var request = axios.create({
   baseURL:'/mz',
   timeout:5000   //超过5000ms即为请求超时
})
//拦截器
request.interceptors.request.use((config)=>{//任何axios请求都会经过他
   config.headers['X-Client-Info']=`{"a":"3000","ch":"1002","v":"5.0.4","e":"15725184423350074491745"}`
   if(config.data["X-Host"]){
      config.headers['X-Host']=config.data['X-Host']
   }
   Indicator.open({
      text: 'Loading...',
      spinnerType: 'fading-circle'
    });;
   return config
})
request.interceptors.response.use((res)=>{
   Indicator.close()
   return res
})

export default request;